#define _CRT_SECURE_NO_WARNINGS 1
#include <climits>
#include <iostream>
using namespace std;

class Date
{
public:
    Date(int year, int month, int day)
    {
        _year = year;
        _month = month;
        _day = day;
    }
    void GetDay(const Date& d)
    {
        int sum = 0;
        int GetMonthDay[13] = { -1,31,28,31,30,31,30,31,31,30,31,30,31 };
        if ((d._year % 4 == 0 && d._year % 100 != 0) || d._year % 400 == 0)
        {
            GetMonthDay[2] = 29;
        }
        for (int i = 1; i < d._month; i++)
        {
            sum += GetMonthDay[i];
        }
        sum += d._day;
        cout << sum << endl;
    }
private:
    int _year;
    int _month;
    int _day;
};

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    Date d1(a, b, c);
    d1.GetDay(d1);
}


class Solution {
public:
    class Sum
    {
    public:
        Sum()
        {
            _ret += _i;
            ++_i;
        }
        static int Get()
        {
            return _ret;
        }
    };
    int Sum_Solution(int n) {
        Sum a[n];

        return Sum::Get();
    }
private:
    static int _i;
    static int _ret;
};

int Solution::_i = 1;
int Solution::_ret = 0;